package xyf.p11.other;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * ClassName: J058_ReverseWords
 * Description:
 * Author: xyf
 * Date: 9/17/22 6:37 PM
 * Version: 1.0
 **/
public class J058_ReverseWords
{
    public String reverseWords(String s)
    {
        s = s.trim();

        List<String> wordList = Arrays.asList(s.split("\\s+"));

        Collections.reverse(wordList);

        return String.join(" ", wordList);
    }
}